home *** CD-ROM | disk | FTP | other *** search
/ The Atari Compendium / The Atari Compendium (Toad Computers) (1994).iso / files / prgtools / mint / lib / mlib34pc.zoo / mntlib34.pc / Makefile < prev    next >
Encoding:
Makefile  |  1993-08-07  |  17.1 KB  |  613 lines

  1. ### Makefile for MiNT Library for Pure C and Turbo C
  2. ### hohmuth 19 Feb 1993
  3. ###
  4. ### This makefile needs GNU make.
  5. ###
  6. ### This makefile is pretty tough.. Make sure your make has a large stack!
  7. ### (The MiNT library's standard stack size (8K) is _not_ enough!)
  8.  
  9. ###
  10. ### begin of configuration section
  11. ###
  12.  
  13. # TURBOC= yes if you still use Turbo C.
  14. # If you do so, I strongly suggest upgrading to Pure C.
  15. # Comment this out if you use Pure C.
  16.  
  17. #TURBOC=        yes
  18.  
  19. # COMPILERDIR= the main directory of your Turbo/Pure C installation
  20. # As file names in rules may not contain colons (`:'), this path
  21. # name should _not_ contain a TOS-style drive specification (like "c:").
  22. # If you define TOSIFY_COMMANDS below, this path will be automatically 
  23. # tosified.
  24.  
  25. #COMPILERDIR=    /dev/g/turboc
  26. COMPILERDIR=    /dev/d/pc
  27.  
  28. # BINDIR= where your compiler's tools (pcc.ttp, plink.ttp etc.) reside
  29.  
  30. #BINDIR=        $(COMPILERDIR)
  31. BINDIR=        $(COMPILERDIR)/bin
  32.  
  33. # LIBDIR= where to search for the compiler's libraries. Some of them are
  34. # linked into the MiNT library.
  35.  
  36. LIBDIR=        $(COMPILERDIR)/lib
  37.  
  38. # COMPILERINCDIR= where to find your compiler's includes, especially
  39. # float.h and math.h.
  40. # This is only needed during "make install-includes".
  41.  
  42. COMPILERINCDIR=    $(COMPILERDIR)/include
  43.  
  44. # INCLUDEDIR= where your MiNT library's include files (mntinc) reside.
  45. # If you define TOSIFY_NAMES below, this is path will be automatically 
  46. # tosified for the compiler's -I switch.
  47.  
  48. INCLUDEDIR=    /dev/z/src/lib/include
  49.  
  50. # OSBINDLIB= the location of the osbind library by Ole Arndt und 
  51. # Ulf Moeller, if you have it.  This library replaces our TOS bindings.
  52. # If you use Turbo C, and don't have `awk', you _should_ get this library.
  53. # If you don't have it, you need to have `awk'.  (we need to hack our
  54. # TOS bindings) 
  55. # For Pure C users: You don't need to have this library.
  56. # Comment this out, if you don't have the osbind library.
  57.  
  58. #OSBINDLIB=    $(LIBDIR)/osbind.lib
  59.  
  60. # INSTALLDIR= the directory you want to have the MiNT library installed to.
  61. # This is only needed during "make install".
  62.  
  63. INSTALLDIR=    $(LIBDIR)
  64.  
  65. # COMMONDIR= where the main bulk of the library source resides
  66.  
  67. COMMONDIR=    ..
  68.  
  69. # ASSERTIONS= yes if you want to activate the library's calls to assert().
  70. # Comment this out if you don't.
  71.  
  72. #ASSERTIONS=    yes
  73.  
  74. # DEBUGINFO= yes, if you want your libraries created with debug info.
  75. # Comment this out if you don't.
  76.  
  77. #DEBUGINFO=    yes
  78.  
  79. # PCREL= yes, if you want all sub-routine calls to be PC relative.
  80. # This can cause problems with bigger projects, however.
  81. # Comment this out if you prefer absolute calls to sub-routines.
  82.  
  83. #PCREL= yes
  84.  
  85. # TOSIFY_NAMES= yes if the compiler's tools (pcc, plink etc.) don't 
  86. # understand Unix-like path names.
  87. # Comment this out if your compiler _does_ understand names like "/dev/c/foo".
  88.  
  89. TOSIFY_NAMES=    yes
  90.  
  91. # TOSIFY_COMMANDS= yes if your shell (see SHELL below) wants path names
  92. # in TOS form (i.e. does not understand unix compatible file names like
  93. # "/dev/c/foo"). Mupfel wants this.
  94. # Comment this out if your shell groks names like "/dev/c/foo".
  95. # NOTE: your versions of rm, cp, etc. _should_ understand
  96. #       unix-like names
  97.  
  98. #TOSIFY_COMMANDS=    yes
  99.  
  100. # sh_backslash= the string that should be passed to the shell as a single
  101. # backslash character. This depends on your shell (whether your
  102. # shell needs backslashes escaped with another backslash, as do most
  103. # unix-like shells). On contrast, Mupfel wants only one backslash, as well
  104. # as the shell that comes with `elvis'.
  105.  
  106. sh_backslash=    \\
  107. #sh_backslash=    \$(nothing)
  108.  
  109. # SHELL, RM, CP, INSTALL_DATA, SED, ECHO: edit to suite your taste
  110. # These programs _should_ understand unix-like path names (like "/dev/c/foo").
  111. # INSTALL_DATA is only needed during "make install" and "make install-includes".
  112. # AWK is only needed when using Turbo C without the osbind library (see
  113. # explanation on OSBINDLIB above)
  114. # ECHO is only needed with Turbo C.
  115. #
  116. # all of these programs should understand the ARGV scheme.
  117.  
  118. SHELL=        /bin/sh            # a bourne shell
  119. #SHELL=        /usr/local/bin/bash    # GNU bash
  120. #SHELL=        c:/usr/gemini/1.89/mupfel.ttp # Mupfel 1.89 (don't try 1.21)
  121. #SHELL=        c:/bin/shell.ttp    # simple shell (from `elvis' distribution)
  122. #SHELL=                    # no shell at all (works only with Pure C)
  123.  
  124. RM=        rm
  125. CP=        cp
  126. AWK=        awk
  127. ECHO=        echo
  128. INSTALL_DATA=    cp
  129. #INSTALL_DATA=    install -m 644
  130.  
  131. ###
  132. ### end of configuration section
  133. ###
  134.  
  135. ### the compiler programs, and what flags they need
  136.  
  137. ifdef TOSIFY_NAMES
  138.   DIRSEP=    $(sh_backslash)
  139. else
  140.   DIRSEP=    /
  141. endif
  142.  
  143. ifdef TURBOC
  144.   CC :=        $(BINDIR)/tcc.ttp -W
  145.   AS :=        $(BINDIR)/mas.ttp
  146.   LD :=        $(BINDIR)/tlink.ttp
  147. else
  148.   CC :=        $(BINDIR)/pcc.ttp -W
  149.   AS :=        $(BINDIR)/pasm.ttp
  150.   LD :=        $(BINDIR)/plink.ttp
  151. endif
  152.  
  153. ifdef TOSIFY_COMMANDS
  154.   tosify_name := $(CC)
  155.   include tosify.mak
  156.   CC := $(tosify_name)
  157.  
  158.   tosify_name := $(AS)
  159.   include tosify.mak
  160.   AS := $(tosify_name)
  161.  
  162.   tosify_name := $(LD)
  163.   include tosify.mak
  164.   LD := $(tosify_name)
  165. endif
  166.  
  167. ifdef DEBUGINFO
  168.   CCSYMFLAGS=    -Y
  169.   ifdef TURBOC
  170.     ASSYMFLAGS=
  171.   else
  172.     ASSYMFLAGS=    -Y
  173.   endif
  174.   LDSYMFLAGS=    -G -L -Y
  175. else
  176.   CCSYMFLAGS=
  177.   ASSYMFLAGS=
  178.   LDSYMFLAGS=    -G
  179. endif
  180.  
  181. ifdef PCREL
  182.   CCRELFLAGS=
  183. else
  184.   CCRELFLAGS=    -P
  185. endif
  186.  
  187. MAKEOBJ=    -J
  188.  
  189. ifdef ASSERTIONS
  190.   CCDEBUGDEFS=
  191. else
  192.   CCDEBUGDEFS=    -DNDEBUG
  193. endif
  194.  
  195. INCSPEC :=    $(INCLUDEDIR)
  196.  
  197. # tosify the include specification
  198. ifdef TOSIFY_NAMES
  199.   tosify_name := $(INCSPEC)
  200.   include tosify.mak
  201.   INCSPEC := $(tosify_name)
  202. endif
  203.  
  204. CCINCFLAGS=    -I$(INCSPEC)
  205.  
  206. # with Turbo C, we need to work around its missing ARGV capability
  207. ifdef TURBOC
  208.   ARGV_WORKAROUND=    yes
  209. else
  210.   ARGV_WORKAROUND=
  211. endif
  212.  
  213. ### default flags to compiler, linker, assembler
  214.  
  215. CCFLAGS=    $(CCINCFLAGS) $(CCSYMFLAGS) $(CCRELFLAGS) $(CCDEBUGDEFS)
  216. ASFLAGS=    $(ASSYMFLAGS)
  217. LDFLAGS=    $(LDSYMFLAGS)
  218.  
  219. ### what to build
  220.  
  221. MINTLIB=    mintlib.lib
  222. MATHLIB=    mintflt.lib
  223. FPUMATHLIB=    mint881.lib
  224. STARTUPOBJ=    crt0.o
  225. ALLOCAOBJ=    alloca.o
  226. FPUALLOCAOBJ=    falloca.o
  227.  
  228. MYTOSLIB=    myosbind.lib
  229.  
  230. DIST_MATHLIB=    d_flt.lib
  231. DIST_FPUMATHLIB=    d_881.lib
  232.  
  233. ifdef TURBOC
  234.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  235.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ)
  236. else
  237.   ALL=        $(MINTLIB) $(MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  238.     $(FPUMATHLIB) $(FPUALLOCAOBJ)
  239.   BINDIST=    $(MINTLIB) $(DIST_MATHLIB) $(STARTUPOBJ) $(ALLOCAOBJ) \
  240.     $(DIST_FPUMATHLIB) $(FPUALLOCAOBJ)
  241. endif
  242.  
  243. .PHONY:        all
  244. all:        $(ALL)
  245.  
  246. .PHONY:        bindist
  247. bindist:    $(BINDIST)
  248.  
  249. ### things we link from the compiler's distribution
  250.  
  251. ifdef TURBOC
  252.   CCFLOATLIB :=    $(LIBDIR)/tcfltlib.lib
  253. else
  254.   CCFLOATLIB :=    $(LIBDIR)/pcfltlib.lib
  255.   CC881LIB :=    $(LIBDIR)/pc881lib.lib
  256. endif
  257.  
  258. CCFLOATLIBSPEC :=    $(CCFLOATLIB)
  259. CC881LIBSPEC :=    $(CC881LIB)
  260.  
  261. # tosify the library specifications, if nessecary
  262. ifdef TOSIFY_NAMES
  263.   tosify_name := $(CCFLOATLIBSPEC)
  264.   include tosify.mak
  265.   CCFLOATLIBSPEC := $(tosify_name)
  266.  
  267.   tosify_name := $(CC881LIBSPEC)
  268.   include tosify.mak
  269.   CC881LIBSPEC := $(tosify_name)
  270. endif
  271.  
  272. ### which OS bindings library to link
  273.  
  274. BUILD_MYTOSLIB_DEP :=
  275.  
  276. # the osbind library replaces our tos library.
  277. ifdef OSBINDLIB
  278.   TOSLIB :=    $(OSBINDLIB)
  279. else
  280.   ifdef TURBOC
  281.     TOSLIB :=    $(MYTOSLIB)
  282.  
  283.     # used as a file dependency for $(MINTLIB)
  284.     BUILD_MYTOSLIB_DEP :=    $(MYTOSLIB)
  285.   else
  286.     TOSLIB :=
  287.   endif
  288. endif
  289.  
  290. TOSLIBSPEC :=    $(TOSLIB)
  291.  
  292. # tosify the library specification, if nessecary
  293. ifdef TOSIFY_NAMES
  294.   tosify_name := $(TOSLIBSPEC)
  295.   include tosify.mak
  296.   TOSLIBSPEC := $(tosify_name)
  297. endif
  298.  
  299. ### how to build MINTLIB
  300.  
  301. COMMONSRC :=    a64l.c abort.c abs.c access.c alarm.c alphasor.c atexit.c \
  302.   atol.c bblink.c bcmp.c binmode.c bsearch.c calloc.c chdir.c chmod.c \
  303.   clock.c close.c console.c crtinit.c ctermid.c \
  304.   ctime.c ctype.c defmode.c dirent.c \
  305.   doprnt.c dup.c eprintf.c exec.c execp.c fclose.c fcntl.c fdopen.c fflush.c \
  306.   fgetc.c fgets.c filbuf.c findfile.c fopen.c fopenp.c fork.c fprintf.c \
  307.   fputc.c fputs.c fread.c frwbin.c fscanf.c fseek.c fsetpos.c ftw.c \
  308.   fungetc.c fwrite.c getbuf.c getcwd.c getdtabl.c getenv.c getgroup.c \
  309.   gethostn.c getlogin.c getopt.c getpages.c getpass.c getpid.c getpw.c \
  310.   getrusag.c gets.c getuid.c getw.c grp.c heapbase.c ic.c ident.c ig.c \
  311.   il.c inistack.c initsig.c ioctl.c ip.c isatty.c iw.c kill.c killpg.c \
  312.   link.c localtim.c lockf.c lseek.c ltoa.c main.c malloc.c memccpy.c \
  313.   memchr.c memcmp.c mkdir.c mknod.c mktemp.c nice.c obstack.c open.c \
  314.   pause.c perror.c pipe.c pgrp.c popen.c psignal.c putenv.c qsort.c raise.c \
  315.   rand.c random.c read.c realloc.c regexp.c regsup.c rename.c rmdir.c \
  316.   sbrk.c scandir.c scanf.c select.c setbuf.c setlocal.c setrlimi.c \
  317.   setvbuf.c sgtty.c sigactio.c sigblock.c siglist.c signal.c sleep.c \
  318.   spawn.c spawnve.c spawnvp.c sprintf.c sscanf.c stat.c statfs.c stksiz.c \
  319.   strcat.c strchr.c strcmp.c strcoll.c strcpy.c strcspn.c strdup.c \
  320.   strerror.c strftime.c stricmp.c strlen.c strlwr.c strncat.c strncmp.c \
  321.   strncpy.c strnicmp.c strpbrk.c strrchr.c strrev.c strspn.c strstr.c \
  322.   strtok.c strtol.c strtoul.c strupr.c symlink.c sysconf.c system.c \
  323.   sysvar.c textio.c thread.c time.c timeoday.c times.c tmpfile.c tmpnam.c \
  324.   toxxx.c ttyname.c uname.c unlink.c unx2dos.c utime.c utmp.c wait.c \
  325.   wait3.c waitpid.c write.c wtmp.c 
  326. COMMONSRC := $(addprefix $(COMMONDIR)/,$(COMMONSRC))
  327.  
  328. SRC :=        bzero.c memset.c alloca2.c \
  329.   bcopy.s linea.s setjmp.s vfork.s
  330.  
  331. ifndef TOSLIB
  332.   # no tos bindings library -- link our bindings.
  333.   SRC :=    $(SRC) osbind.s bios.s xbios.s gemdos.s mintbind.s
  334.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  335. endif
  336.  
  337. ifdef TURBOC
  338.   SUPPORTSRC=    fpuinit.c stkover.s
  339. else
  340.   SUPPORTSRC=    fpuinit.c stkover.s pclong.s 
  341. endif
  342.  
  343. MINTSRC=    $(COMMONSRC) $(SUPPORTSRC) $(SRC)
  344.  
  345. MINTOBJ :=    $(patsubst %.c,%.o,$(MINTSRC))
  346. MINTOBJ :=    $(patsubst %.s,%.o,$(MINTOBJ))
  347.  
  348. ifdef ARGV_WORKAROUND
  349.   MINTLIB_CMD=    $(basename $(MINTLIB)).cmd
  350.   MINTLIB_PARAM=    -C=$(MINTLIB_CMD)
  351.   MINTLIB_DEP=    $(MINTOBJ) $(MINTLIB_CMD)
  352.  
  353.   $(MINTLIB_CMD):
  354.     -$(RM) -f $@
  355.     $(ECHO) -n $(subst /,$(DIRSEP),$(MINTOBJ)) > $@
  356. else
  357.   MINTLIB_PARAM=    $(subst /,$(DIRSEP),$(MINTOBJ))
  358.   MINTLIB_DEP=    $(MINTOBJ)
  359. endif
  360.  
  361. ifneq (,$(wildcard $(firstword $(MINTSRC))))
  362.   $(MINTLIB):    $(MINTLIB_DEP) $(BUILD_MYTOSLIB_DEP)
  363.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $(MINTLIB_PARAM) $(TOSLIBSPEC)
  364. else
  365. # if the source is not present (binary distribution), we just check for
  366. # the presence of the library.
  367.   $(MINTLIB): ;
  368. endif
  369.  
  370. %.o:        %.s
  371.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  372.  
  373. %.o:        %.c
  374.     $(CC) $(CCFLAGS) -D__NO_FLOAT__ \
  375.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  376.  
  377. $(COMMONDIR)/crtinit.o:    $(COMMONDIR)/crtinit.c
  378.     $(CC) -P -S- -T- $(CCFLAGS) -D__NO_FLOAT__ \
  379.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  380.  
  381. $(COMMONDIR)/main.o:    $(COMMONDIR)/main.c
  382.     $(CC) -P $(CCFLAGS) -D__NO_FLOAT__ \
  383.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  384.  
  385. $(COMMONDIR)/qsort.o:    $(COMMONDIR)/qsort.c
  386.     $(CC) -S -T $(CCFLAGS) -D__NO_FLOAT__ \
  387.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  388.  
  389. $(COMMONDIR)/thread.o:    $(COMMONDIR)/thread.c
  390.     $(CC) -P -S- $(CCFLAGS) -D__NO_FLOAT__ \
  391.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  392.  
  393. setjmp.o:    setjmp.s
  394.     $(AS) $(ASFLAGS) -D=FPU=0 \
  395.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  396.  
  397. ### how to build MYTOSLIB, our own tos bindings library
  398.  
  399. ifdef TURBOC
  400.   # for Turbo C, this is quite tricky.  Turbo's assembler MAS doesn't
  401.   # understand the directives ".MODULE" and ".ENDMOD", but we still want
  402.   # one module per binding.  That's why we use awk to cut modules
  403.   # from the source files and build one object file per binding.
  404.  
  405.   MYBINDSRC :=    bios.s xbios.s gemdos.s mintbind.s
  406.   
  407.   # we make a list of object file we want to build and re-instantiate `make'.
  408.   # in the new instance, we include that list into our makefile
  409.   MAKEINCL :=    myosbind.mak
  410.  
  411.   ifndef MAKEINCL_OK
  412.     $(MAKEINCL):    $(MYBINDSRC)
  413.     $(AWK) 'BEGIN { FS = " |:|\t" ; printf "MYBINDOBJ := " } /^\.MODULE/ { printf "%s.o ", $$2 }' \
  414.       $^ > $@
  415.  
  416.     $(MYTOSLIB):    $(MYBINDSRC) osmacros.s osbind.s $(MAKEINCL)
  417.     $(MAKE) $(MYTOSLIB) MAKEINCL_OK=yes
  418.   else
  419.  
  420.     # this should define MYBINDOBJ
  421.     include $(MAKEINCL)
  422.  
  423.     $(MYBINDOBJ):    %.o:    $(MYBINDSRC) osmacros.s
  424.     -$(RM) -f temp.s
  425.     $(AWK) -v name=$(patsubst %.o,%,$@) -f filter.awk $(MYBINDSRC) > temp.s
  426.     $(AS) $(ASFLAGS) -O=$@ temp.s
  427.  
  428.     ifdef ARGV_WORKAROUND
  429.       MYTOSLIB_CMD=    $(basename $(MYTOSLIB)).cmd
  430.       MYTOSLIB_PARAM=    -C=$(MYTOSLIB_CMD)
  431.       MYTOSLIB_DEP=    $(MYBINDOBJ) $(MYTOSLIB_CMD)
  432.     
  433.       $(MYTOSLIB_CMD):    $(MAKEINCL)
  434.     -$(RM) -f $@
  435.     $(ECHO) -n $(MYBINDOBJ) > $@
  436.     else
  437.       MYTOSLIB_PARAM=    $(MYBINDOBJ)
  438.       MYTOSLIB_DEP=    $(MYBINDOBJ)
  439.     endif
  440.  
  441.     $(MYTOSLIB):    osbind.o $(MYTOSLIB_DEP)
  442.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ osbind.o $(MYTOSLIB_PARAM)
  443.  
  444.   endif
  445. else
  446.   # with Pure C, everything's so much easier :-)
  447.   # however, it's unlikely that you'll need this.
  448.  
  449.   MYTOSSRC :=    osbind.s bios.s xbios.s gemdos.s mintbind.s
  450.   MYTOSOBJ :=    $(patsubst %.s,%.o,$(MYTOSSRC))
  451.  
  452.   bios.o xbios.o gemdos.o mintbind.o:    osmacros.s
  453.  
  454.   $(MYTOSLIB):    $(MYTOSOBJ)
  455.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ $^
  456.  
  457. endif
  458.  
  459. ### how to build MATHLIB
  460.  
  461. MATHOBJ=    m_main.o m_doprnt.o m_scanf.o m_difftime.o
  462.  
  463. ifneq ($(DIST_MATHLIB),$(wildcard $(DIST_MATHLIB)))
  464.   $(MATHLIB):    $(MATHOBJ) # $(CCFLOATLIB)
  465.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  466.       $(subst /,$(DIRSEP),$(MATHOBJ)) $(CCFLOATLIBSPEC)
  467. else
  468. # link with the bindist's rudimentary math library, if it exists
  469.   $(MATHLIB):    $(DIST_MATHLIB) # $(CCFLOATLIB)
  470.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  471.       $(DIST_MATHLIB) $(CCFLOATLIBSPEC)
  472. endif
  473.  
  474. ifneq (,$(wildcard $(patsubst m_%.o,$(COMMONDIR)/%.c,$(firstword $(MATHOBJ)))))
  475.   $(DIST_MATHLIB):    $(MATHOBJ)
  476.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  477.       $(subst /,$(DIRSEP),$(MATHOBJ))
  478. else
  479. # if the source is not present (binary distribution), we just check for
  480. # the presence of the distributable library.
  481.   $(DIST_MATHLIB): ;
  482. endif
  483.  
  484. m_%.o:        $(COMMONDIR)/%.c
  485.     $(CC) -T- $(CCFLAGS) \
  486.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  487.  
  488. m_main.o:    $(COMMONDIR)/main.c
  489.     $(CC) -T- -P $(CCFLAGS) \
  490.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  491.  
  492. ### how to build FPUMATHLIB
  493.  
  494. FPUMATHOBJ =    f_main.o f_doprnt.o f_scanf.o f_difftime.o f_setjmp.o
  495.  
  496. ifneq ($(DIST_FPUMATHLIB),$(wildcard $(DIST_FPUMATHLIB)))
  497.   $(FPUMATHLIB):    $(FPUMATHOBJ) # $(CC881LIB)
  498.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  499.       $(subst /,$(DIRSEP),$(FPUMATHOBJ)) $(CC881LIBSPEC)
  500. else
  501. # link with the bindist's rudimentary math library, if it exists
  502.   $(FPUMATHLIB):    $(DIST_FPUMATHLIB) # $(CC881LIB)
  503.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  504.       $(DIST_FPUMATHLIB) $(CC881LIBSPEC)
  505. endif
  506.  
  507. ifneq (,$(wildcard $(patsubst f_%.o,$(COMMONDIR)/%.c,$(firstword $(FPUMATHOBJ)))))
  508.   $(DIST_FPUMATHLIB):    $(FPUMATHOBJ)
  509.     $(LD) $(MAKEOBJ) $(LDFLAGS) -O=$@ \
  510.       $(subst /,$(DIRSEP),$(FPUMATHOBJ))
  511. else
  512. # if the source is not present (binary distribution), we just check for
  513. # the presence of the distributable library.
  514.   $(DIST_FPUMATHLIB): ;
  515. endif
  516.  
  517. f_%.o:        $(COMMONDIR)/%.c
  518.     $(CC) -T- -8 $(CCFLAGS) \
  519.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  520.  
  521. f_main.o:    $(COMMONDIR)/main.c
  522.     $(CC) -T- -8 -P $(CCFLAGS) \
  523.       -O$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  524.  
  525. f_setjmp.o:    setjmp.s
  526.     $(AS) $(ASFLAGS) -D=FPU=1 \
  527.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  528.  
  529. ### how to build the startup code
  530.  
  531. STARTUPSRC=    crt0.s
  532.  
  533. ifneq (,$(wildcard $(STARTUPSRC)))
  534.   $(STARTUPOBJ):    $(STARTUPSRC)
  535.     $(AS) $(ASFLAGS) -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  536. else
  537. # if the source is not present (binary distribution), we just check for
  538. # the presence of the object files.
  539.   $(STARTUPOBJ): ;
  540. endif
  541.  
  542. ### how to build the fast versions of alloca()
  543.  
  544. ALLOCASRC=    alloca.s
  545.  
  546. ifneq (,$(wildcard $(ALLOCASRC)))
  547.   $(ALLOCAOBJ):    $(ALLOCASRC)
  548.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=0 \
  549.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  550.  
  551.   $(FPUALLOCAOBJ):    $(ALLOCASRC)
  552.     $(AS) $(ASFLAGS) -D=STACKCH=1 -D=FPU=1 \
  553.       -O=$(subst /,$(DIRSEP),$@) $(subst /,$(DIRSEP),$<)
  554. else
  555. # if the source is not present (binary distribution), we just check for
  556. # the presence of the object files.
  557.   $(ALLOCAOBJ): ;
  558.   $(FPUALLOCAOBJ): ;
  559. endif
  560.  
  561. ### how to build the test program
  562.  
  563. .PHONY:        test
  564. test:        test.tos
  565.  
  566. ifdef TURBOC
  567.   CCSTDLIB :=    $(LIBDIR)/tcstdlib.lib
  568.   CCSTDLIBSPEC :=    $(CCSTDLIB)
  569.   ifdef TOSIFY_NAMES
  570.     tosify_name :=    $(CCSTDLIBSPEC)
  571.     include tosify.mak
  572.     CCSTDLIBSPEC :=    $(tosify_name)
  573.   endif
  574.  
  575.   TEST_LINKLIBS=    $(CCSTDLIBSPEC)
  576. else
  577.   TEST_LINKLIBS=
  578. endif
  579.  
  580. test.tos:    $(MINTLIB) $(STARTUPOBJ) test.o
  581.     $(LD) $(LDFLAGS) -S=0 -O=$@ $(STARTUPOBJ) test.o \
  582.       $(MINTLIB) $(TEST_LINKLIBS)
  583.  
  584. test.o:        test.c
  585.     $(CC) -S $(CCFLAGS) -O$@ $<
  586.     
  587. ### how to make clean
  588.  
  589. .PHONY:        clean
  590. clean:
  591.     -$(RM) -f $(COMMONDIR)/*.o
  592.     -$(RM) -f *.o
  593.     -$(RM) -f *.cmd
  594.     -$(RM) -f temp.s test.tos
  595.  
  596. .PHONY:        realclean
  597. realclean:    clean
  598.     -$(RM) -f *.lib
  599. ifdef MAKEINCL
  600.     -$(RM) -f $(MAKEINCL)
  601. endif
  602.  
  603. ### how to install
  604.  
  605. .PHOHY:        install
  606. install:    $(ALL)
  607.     $(INSTALL_DATA) $(ALL) $(INSTALLDIR)
  608.  
  609. .PHONY:        install-includes
  610. install-includes:
  611.     $(INSTALL_DATA) $(COMPILERINCDIR)/float.h $(INCLUDEDIR)/tcfloat.h
  612.     $(INSTALL_DATA) $(COMPILERINCDIR)/math.h $(INCLUDEDIR)/tcmath.h
  613.